<!-- 头部 start -->
<script src="js/getParameter.js"></script>


<script>
    var msg = "";
    $(function () {
        msg = "welcome,";
        //查询用户信息
        $("#span_cmd").css("display", "none")
        $.get("user/findOne", {}, function (data) {
            //{uid:1,name:'李四'}
            // var msg = msg + data.realname;
            var len = msg.length;
            msg = msg.concat(data.realname);
            if (data.username == "admin") {
                $("#span_cmd").css("display", "inline-block")
            }else{
                $("#span_cmd").css("display", "none")
            }
            $("#span_username").html(msg);
            if (msg.length > len) {
                // alert(msg)
                $("#login_out").css("display", "none")
            }

        });


    });

    $(function () {
        var url;
        url = window.location.href;

        //http://localhost/gameweb/index.html
        url = url.substring(url.lastIndexOf("/") + 1, url.length);
        if (url.length == 0) {
            $("#aa").addClass("active");
        }

        if (url == "index.html" || url == "index.html#" || url=="index.html?gname=") {

            $("#aa").addClass("active");
        } else if (url == "app_list.html") {
            $("#bb").addClass("active");
        } else if (url == "userhome.html") {
            $("#ff").addClass("active");
        } else if (url == "say.html") {
            $("#dd").addClass("active");
        }
    })

    //给搜索按钮绑定单击事件，获取搜索输入框的内容
    $("#search-button").click(function () {
        //线路名称
        // alert(111)
        var gname = $("#search_button").val();
        // alert(gname)
        //跳转路径
        // location.href="http://localhost/gameweb/index.html?gname="+gname;
        location.href="index.html?gname="+gname;
        // alert(cid)
    })


</script>


<header class="container-fluid" id="header">
    <div class="row paddtop">
        <div class="col-md-4 paddleft">
            <img src="img/logo.png" class="img-responsive">
        </div>

        <div class="col-lg-3 paddtop11">
            <div class="input-group">
                <input type="text" class="form-control" id="search_button" placeholder="Search for...">
                        <span class="input-group-btn">
                            <button class="btn btn-default" id="search-button" type="button">搜索</button>
                        </span>

                </div><!-- /input-group -->
        </div><!-- /.col-lg-6 -->
        <div class="col-md-5 paddleft paddtop1">

            <img src="img/add.png" class="img-responsive">

        </div>

    </div>

    <!--导航栏-->
    <div class="row">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <!-- 定义汉堡按钮 -->
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">0x3f3f3f3f</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse pllll" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav ull">
                        <!--                        <li class="active"><a href="index.html">首页 <span class="sr-only">(current)</span></a></li>-->
                        <li class="" id="aa"><a href="index.html?gname=">首页 <span class="sr-only">(current)</span></a></li>
                        <li class="" id="bb"><a href="app_list.html">应用</a></li>
                        <li class="" id="cc"><a href="#">论坛</a></li>
                        <li class="" id="dd"><a href="chatroom.html">吐槽</a></li>
                        <li class="" id="ee"><a href="#">收藏夹</a></li>

                        <li lass="" id="ff"><a href="userhome.html">个人中心</a></li>

                    </ul>

                    <div class="shortcut s111">
                        <!-- 未登录状态  -->
                        <div class="login_out" id="login_out">
                            <a href="login.html">登录</a>
                            <a href="regist.html">注册</a>
                        </div>
                        <!-- 登录状态  -->
                        <div class="login" id="login" style="display: block">

                            <span id="span_username"></span>
                            <span id="span_cmd" style="display: none">

                                <a href="javascript:location.href='findAllServlet';">控制台</a>
                            </span>
                            <a href="javascript:location.href='user/exit';">退出</a>
                            &nbsp;&nbsp;
                        </div>
                    </div>

                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>

    </div>
</header>


